var e = require;
var t = module;
var o = exports;
var n = o;
Object.defineProperty(n, "__esModule", {value: !0}), (n.GlobalHttp = void 0);
var i = e("Util"),
    a = (function () {
        function e() {}
        return (
            (e.init = function () {
                (fly.config.baseURL = e.baseUrl),
                    (fly.config.timeout = 3e3),
                    fly.interceptors.request.use(e.onSend),
                    fly.interceptors.response.use(e.onSucceed, e.onError);
            }),
            (e.onSend = function (e) {
                e.headers["Content-Type"] = "application/x-www-form-urlencoded";
            }),
            (e.onSucceed = function (e) {
                var t = e.data;
                if ((i.default.isJSON(t) && (t = JSON.parse(t)), t && t.ifsuccess)) return t.data;
                throw new Error("接口请求失败");
            }),
            (e.onError = function (e) {
                throw new Error("接口请求失败:" + JSON.stringify(e));
            }),
            (e.baseUrl = ""),
            e
        );
    })();
n.GlobalHttp = a;
